function initArchiveTypeList () {
  var select = document.getElementById('typeSelect');
  var options = select.querySelectorAll('option');
  var values = [];
  options.forEach(function(option) {
    values.push({value:option.value,name:option.text});
  });
  console.log(values); // 打印所有option的value值
  var data = '';
  values.forEach(function(item) {
    data = data + '<tr><td><input type="hidden" name="type" value=' + item.value + '>' + item.name + '</td>'
          + '<td><a href="javascript:void(0);" onclick="hanldArchive(this, 0); return false;">档案详情</a></td>'
          + '<td><a href="javascript:void(0);" onclick="hanldArchive(this, 1); return false;">添加档案</a></td></tr>'
  });
  $("#archiveTypeList").find("tbody").html(data);
  // $("#typeModal").modal("show");
}

function hanldArchive (obj, type) {
  // $("#typeModal").modal("hide");
  $("#type").hide();
  var val = $(obj).parent().parent().find("input[name='type']").val();
  console.log(obj, val);
  $("select[name='type']").val(val);
  if (type === 0) {
    getArchive();
  } else {
    getArchive()
    addArchive()
  }
}

// 冒泡排序
const bubbleSort = () => {
  let arr = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10];
  for (let i = 0; i < arr.length - 1; i++) {
    for (let j = 0; j < arr.length - 1 - i; j++) {
      if (arr[j] > arr[j + 1]) {
        let temp = arr[j];
        arr[j] = arr[j + 1];
        arr[j + 1] = temp;
      }
    }
  }
}